integer

pure constructor(value: text, [radix: integer])

Construct an integer object by parsing a signed text representation of an integer.

Base prefixes are not supported, so one must write e.g. integer('CAFE', 16) rather than integer('0xCAFE').

Case is ignored, i.e. integer('CAFE', 16) and integer('cafe', 16) are equivalent.

Supported radixes are from 2 to 36 (inclusive).

Since

0.6.0

Parameters

value

the text to be parsed

radix

the radix to be used in parsing value; defaults to 10 if not provided

Throws

exception

when:

  • the textual representation is ill-formed

  • radix is outside the supported range


pure constructor(value: decimal)

Construct an integer from a decimal, with any fractional part truncated (i.e. rounding toward 0).

Since

0.9.1

Parameters

value

the decimal value to convert to an integer